package types

import "github.com/google/uuid"

type Config struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	User     string `json:"user"`
	Password string `json:"password"`
	Database string `json:"database,omitempty"`
}

type Connection struct {
	Uuid   string `json:"uuid"`
	Name   string `json:"name"`
	Config Config `json:"config"`
}

func (c *Connection) CatUuid() {
	if c.Uuid == "" {
		c.Uuid = uuid.New().String()
	}
}

type Connections []Connection

// ConfigMap 用于存储所有连接配置
// key 为 uuid，value 为 Connection
// type ConfigMap map[string]Connection

type ConfigMap map[string]Connection
